import Vue from 'vue'
import Router from 'vue-router'

import routes from "./common/config/router.js"

Vue.use(Router)

// 如果出现 NavigationDuplicated: Avoided redundant navigation to current location: “/“
// 参考下面这个 https://blog.csdn.net/weixin_42402845/article/details/108334329
//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

let router = new Router({ routes })

export default router